class ImageUtil { static foStaticUrl = window.UIPage.server['fo-static']; static itemUrl = window.UIPage.itemUrl; static imageCdn = 'https://item.elandrs.com'; static getCdnFullPath(imagePath='', width='', height='', quality='100') { let domain = ''; if(imagePath) { if(imagePath.startsWith('r')) { domain = this.itemUrl; } else { domain = this.imageCdn; } const path = this.getCdnPath(imagePath); const params = '?w='+width+'&h='+height+'&q='+quality+''; if(!(path.endsWith(".gif")) && (width || height)) { return domain + '/' + path + params; } else { return domain + '/' + path; } } else { return ''; } } static getCdnPath(imagePath='') { if(imagePath) { if(imagePath.trim().startsWith('/')) { return 'upload' + imagePath.trim(); } else { return imagePath.trim(); } } else { return ''; } } }